import model

def main(addresses):
    with model.session_scope() as session:
        hosts = session.query(model.Address).all()
        for ip, interface in addresses.items(): 
            if interface != 'aaabbb':       
                seenbefore = False
                for host in hosts:
                    if host.ip == ip:
                        seenbefore = True
                        host.seen()
                if seenbefore == False:
                    new_host = model.Address(ip, interface)
                    session.add(new_host)
        for host in hosts:
            host.aging() 
              
